// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0

Sub := Rectangle {
    width: 25%;
    height: 35%;
}

TestCase := Rectangle {
    width: 600phx;
    inner_rect := Rectangle {
        width: 50%;
        inner_inner := Sub { }
    }
    property<length> test_length: inner_rect.width;
    property<length> test_inner_inner_length: inner_inner.width;


    height: 200phx;
    property<percent> controller: 10%;
    inner_rect_2 := Rectangle {
        height: parent.controller;
    }
    property<length> controlled_test_length: inner_rect_2.height;
}


/*

```cpp
auto handle = TestCase::create();
const TestCase &instance = *handle;
assert_eq(instance.get_test_length(), 300.);
assert_eq(instance.get_test_inner_inner_length(), 300. / 4.);

assert_eq(instance.get_controlled_test_length(), 20.);
instance.set_controller(50);
assert_eq(instance.get_controlled_test_length(), 100.);

```


```rust
let instance = TestCase::new().unwrap();
assert_eq!(instance.get_test_length(), 300.);
assert_eq!(instance.get_test_inner_inner_length(), 300. / 4.);

assert_eq!(instance.get_controlled_test_length(), 20.);
instance.set_controller(50.);
assert_eq!(instance.get_controlled_test_length(), 100.);
```

```js
var instance = new slint.TestCase({});
assert.equal(instance.test_length, 300.);
assert.equal(instance.test_inner_inner_length, 300. / 4.);

assert.equal(instance.controlled_test_length, 20.);
instance.controller = 50.;
assert.equal(instance.controlled_test_length, 100.);
```

*/
